import React from 'react'
import { Switch, Route, Redirect } from 'react-router-dom'
import { permissionList } from './routes'
import LayoutFram from './layout'

function App() {
  return (
    <LayoutFram>
      <Switch>
        {permissionList.map(route => {
          return (
            <Route
              key={route.path}
              path={route.path}
              component={route.component}
              exact
            />
          )
        })}
        <Redirect to="/admin/dashboard" from="/admin" exact />
        <Redirect to="/404" />
      </Switch>
    </LayoutFram>
  )
}

export default App
